
    <!DOCTYPE html>
    <html lang="zh-CN">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>14、SpringMVC - 学习卡片</title>
      <style>
        body { font-family: sans-serif; background-color: #f0f8ff; color: #333; display: flex; flex-direction: column; align-items: center; padding: 50px 20px; }
        .header h1 { font-size: 32px; }
        .grid-container { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; width: 100%; max-width: 1200px; }
        .card-container { perspective: 1200px; cursor: pointer; height: 250px; }
        .card { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 0.7s; border-radius: 16px; box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
        .card-container.flipped .card { transform: rotateY(180deg); }
        .card-face { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; display: flex; flex-direction: column; box-sizing: border-box; border-radius: 16px; background-color: #fff; padding: 24px; }
        .card-back { background-color: #f0fff4; transform: rotateY(180deg); justify-content: space-between; }
        .card-category { font-size: 14px; color: #0052d9; margin-bottom: 8px; font-weight: 500; }
        .card-question { font-size: 20px; font-weight: 500; flex-grow: 1; display: flex; align-items: center; justify-content: center; text-align: center; }
        .card-answer-wrapper { flex-grow: 1; overflow-y: auto; }
        .card-answer { font-size: 15px; line-height: 1.7; }
        .card-footer { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 16px; margin-top: 16px; }
        .card-source { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 12px; margin-top: 12px; }
      </style>
    </head>
    <body>
      <div class="header">
        <h1>14、SpringMVC - 学习卡片</h1>
      </div>
      <div class="grid-container">
        
    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">模式</div>
          <div class="card-question">SpringMVC 框架是基于哪种设计模式？其核心分发组件是什么？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">模式</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">SpringMVC 基于前端控制器模式（Front Controller Pattern），所有的请求都通过 DispatcherServlet 进行分发。</div>
          </div>
          <div class="card-source">来源: 1. SpringMVC 架构概述</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">组件</div>
          <div class="card-question">在 SpringMVC 的前端控制器模式中，HandlerMapping 和 HandlerAdapter 的主要职责分别是什么？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">组件</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">HandlerMapping（处理器映射器）根据请求的 URL 定位到相应的处理器（Controller）。HandlerAdapter（处理器适配器）用于将请求适配为 Controller 的方法调用。</div>
          </div>
          <div class="card-source">来源: 1.1. 前端控制器模式</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">核心机制</div>
          <div class="card-question">DispatcherServlet 作为 SpringMVC 的核心，它在处理用户请求时是如何协调 HandlerMapping 和 HandlerAdapter 的？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">核心机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">当用户发起请求时，DispatcherServlet 会拦截请求，首先使用 HandlerMapping 来查找对应的处理器，找到处理器后，再使用 HandlerAdapter 来执行该处理器。</div>
          </div>
          <div class="card-source">来源: 2.1. 初始化和请求分发</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">组件</div>
          <div class="card-question">SpringMVC 中最常用的 HandlerMapping 实现是什么？它的核心功能是什么？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">组件</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">最常用的是 RequestMappingHandlerMapping。它的核心功能是根据请求的 URL 匹配到具体的处理器方法。</div>
          </div>
          <div class="card-source">来源: 3. HandlerMapping：请求与处理器的映射</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">RequestMappingHandlerAdapter 是如何调用控制器方法的？调用后返回的结果被封装成什么对象？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">RequestMappingHandlerAdapter 通过反射调用控制器的具体方法，并将执行结果封装为 ModelAndView 对象。</div>
          </div>
          <div class="card-source">来源: 4.1. 适配器的核心方法</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">数据传递</div>
          <div class="card-question">在 SpringMVC 中，ModelAndView 对象的主要用途是什么？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">数据传递</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">ModelAndView 用于将控制器处理后的模型数据（Model）和逻辑视图名（View Name）一起传递给视图解析器进行后续的视图渲染。</div>
          </div>
          <div class="card-source">来源: 5.2. 数据的传递与绑定</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">组件</div>
          <div class="card-question">解释 ViewResolver（视图解析器）在 SpringMVC 中的作用，并以 InternalResourceViewResolver 为例说明其工作方式。</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">组件</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">ViewResolver 的作用是根据控制器返回的逻辑视图名解析出具体的视图对象。例如，InternalResourceViewResolver 会将逻辑视图名（如 'helloView'）加上配置的前缀和后缀，解析成一个具体的视图路径（如 '/WEB-INF/views/helloView.jsp'）。</div>
          </div>
          <div class="card-source">来源: 6. ViewResolver：视图的解析</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">特性</div>
          <div class="card-question">SpringMVC 中的 HandlerInterceptor 机制是什么？它通常用于哪些场景？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">特性</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">HandlerInterceptor 是一种在请求处理前后进行拦截操作的机制。它常被用于权限校验、日志记录等场景。</div>
          </div>
          <div class="card-source">来源: 7. SpringMVC 中的拦截器：HandlerInterceptor</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">请描述 HandlerInterceptor 接口中 preHandle, postHandle, 和 afterCompletion 三个核心方法的执行时机。</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">preHandle 在请求处理之前执行；postHandle 在请求处理之后、视图渲染之前执行；afterCompletion 在整个请求完成之后（包括视图渲染后）执行。</div>
          </div>
          <div class="card-source">来源: 7.1. 拦截器的核心方法</div>
        </div>
      </div>
    </div>

      </div>
    </body>
    </html>
